Azure Maps Route Service (stable:2025-01-01)

2025/03/20 • 1 updated methods

Route_PostRouteMatrixAsync (updated)
Description The `Route Matrix Async` API is an HTTP `POST` request that allows calculation of a matrix of route summaries for a set of routes defined by origin and destination locations by using an asynchronous (async) request. For every given origin, the service calculates the cost of routing from that origin to every given destination. The set of origins and the set of destinations can be thought of as the column and row headers of a table and each cell in the table contains the costs of routing from the origin to the destination for that cell. Route Matrices can be calculated for driving, walking and truck routes. Route Matrices are used in several different types of applications, most commonly to solve the Traveling Salesman Problem (TSP) and Vehicle Routing Problem (VRP). For each origin-destination pair in the matrix, the travel time and distance are returned. You can use the computed costs to determine which detailed routes to calculate using the Route Directions API. The maximum size of a matrix for async request is **50000** (the number of origins multiplied by the number of destinations). ### Submit Asynchronous Route Matrix Request The Asynchronous API is appropriate for processing big volumes of relatively complex routing requests. When you make a request by using async request, by default the service returns a 202 response code along a URL in the `operation-Location` field of the response header with the Azure Maps geography endpoint `{geography}.atlas.microsoft.com. This URL should be checked periodically until the status is Succeeded. The maximum size of a matrix for this API is **50000** (the number of origins multiplied by the number of destinations). With that constraint in mind, examples of possible matrix dimensions are: 500x100, 100x100, 280x170. 100x50 (it does not need to be square). The asynchronous responses are stored for **24** hours. The redirect URL returns a 404 response if used after the expiration period. ``` POST https://atlas.microsoft.com/route/matrix:async?api-version=2025-01-01&subscription-key={subscription-key} ``` Here's a typical sequence of asynchronous operations: 1. Client sends a Route Matrix POST request to Azure Maps 2. The server will respond with one of the following: > HTTP `202 Accepted` - Route Matrix request has been accepted. > HTTP `Error` - There was an error processing your Route Matrix request. This could either be a 400 Bad Request or any other Error status code. 3. If the Matrix Route request was accepted successfully, the `operation-location` header in the response contains the URL to get the status of the request. This status URI looks like the following: ``` GET https://atlas.microsoft.com/route/operations/{id}?api-version=2025-01-01?subscription-key={subscription-key} ``` 4. Client issues a GET request on the resultUrl obtained in Step 3 to get the results ``` GET https://atlas.microsoft.com/route/operations/{id}/result?api-version=2025-01-01?subscription-key={subscription-key} ``` ### API Limitations The asynchronous processing of matrix is best suited for larger matrices that require heavy route calculation. The following limitation is applicable to the asynchronous requests. If none of the rows in the following table match the request's parameters, the request does not meet the requirements and will not be processed. | Max matrix size  | Max number of origins | Max number of destinations  | Additional limits | |------------------|-----------------------|-----------------------------|-------------------| | 2500  | 1000  | 1000  | All origins and destinations should be contained in an axis-aligned 400 km x 400 km bounding box. Otherwise some matrix cells will be resolved as OUT_OF_REGION.  | | 50,000  | 10,000  | 10,000  | - `departAt` or `arriveAt` must be any.
- `traffic` must be historical.
- `optimizeRoute` must be fastest.
- `travelMode` must be either driving or truck. 
- No other parameters can be used explicitly.  |
Reference Link ¶

⚶ Changes

{
  "#id": "Route_PostRouteMatrixAsync",
  "Description": {
    "new": "The `Route Matrix Async` API is an HTTP `POST` request that allows calculation of a matrix of route summaries for a set of routes defined by origin and destination locations by using an asynchronous (async) request. For every given origin, the service calculates the cost of routing from that origin to every given destination. The set of origins and the set of destinations can be thought of as the column and row headers of a table and each cell in the table contains the costs of routing from the origin to the destination for that cell.  Route Matrices can be calculated for driving, walking and truck routes.\n\nRoute Matrices are used in several different types of applications, most commonly to solve the Traveling Salesman Problem (TSP) and Vehicle Routing Problem (VRP). For each origin-destination pair in the matrix, the travel time and distance are returned. You can use the computed costs to determine which detailed routes to calculate using the Route Directions API.\n\n\nThe maximum size of a matrix for async request is **50000** (the number of origins multiplied by the number of destinations).\n\n\n### Submit Asynchronous Route Matrix Request\nThe Asynchronous API is appropriate for processing big volumes of relatively complex routing requests. When you make a request by using async request, by default the service returns a 202 response code along a URL in the `operation-Location` field of the response header with the Azure Maps geography endpoint `{geography}.atlas.microsoft.com. This URL should be checked periodically until the status is Succeeded. \n\n\nThe maximum size of a matrix for this API is **50000** (the number of origins multiplied by the number of destinations). With that constraint in mind, examples of possible matrix dimensions are: 500x100, 100x100, 280x170. 100x50 (it does not need to be square).\n\n\nThe asynchronous responses are stored for **24** hours. The redirect URL returns a 404 response if used after the expiration period.\n\n\n\n\n```\nPOST https://atlas.microsoft.com/route/matrix:async?api-version=2025-01-01&subscription-key={subscription-key}\n```\n\nHere's a typical sequence of asynchronous operations:\n1. Client sends a Route Matrix POST request to Azure Maps\n\n2. The server will respond with one of the following:\n\n    > HTTP `202 Accepted` -  Route Matrix request has been accepted.\n\n    > HTTP `Error` - There was an error processing your Route Matrix request. This could either be a 400 Bad Request or any other Error status code.\n\n\n3. If the Matrix Route request was accepted successfully, the `operation-location` header in the response contains the URL to get the status of the request. This status URI looks like the following:\n\n  ```\n    GET https://atlas.microsoft.com/route/operations/{id}?api-version=2025-01-01?subscription-key={subscription-key}\n  ```\n\n\n4. Client issues a GET request on the resultUrl obtained in Step 3 to get the results\n\n \n\n  ```\n    GET https://atlas.microsoft.com/route/operations/{id}/result?api-version=2025-01-01?subscription-key={subscription-key}\n   ```\n\n\n\n ### API Limitations\n The asynchronous processing of matrix is best suited for larger matrices that require heavy route calculation. The following limitation is applicable to the asynchronous requests. If none of the rows in the following table match the request's parameters, the request does not meet the requirements and will not be processed.\n\n | Max matrix\u00a0size\u00a0 | Max number\u00a0of origins | Max number\u00a0of destinations\u00a0 | Additional limits\u00a0|\n|------------------|-----------------------|-----------------------------|-------------------|\n| 2500\u00a0            | 1000\u00a0                 | 1000\u00a0                       | All origins and destinations should be contained in an axis-aligned 400\u202fkm\u202fx\u202f400\u202fkm bounding box. Otherwise some matrix cells will be resolved as\u202fOUT_OF_REGION.\u00a0 |\n| 50,000\u00a0          | 10,000\u00a0               | 10,000\u00a0                     | - `departAt`\u202for\u202f`arriveAt`\u202fmust be\u202fany.
- `traffic`\u202fmust be\u202fhistorical.
- `optimizeRoute` must be\u202ffastest.
- `travelMode`\u202fmust be either\u202fdriving\u202for\u202ftruck.\u00a0
- No other parameters can be used explicitly.\u00a0 |\n\n\n", "old": "The `Route Matrix Async` API is an HTTP `POST` request that allows calculation of a matrix of route summaries for a set of routes defined by origin and destination locations by using an asynchronous (async) request. For every given origin, the service calculates the cost of routing from that origin to every given destination. The set of origins and the set of destinations can be thought of as the column and row headers of a table and each cell in the table contains the costs of routing from the origin to the destination for that cell. Route Matrices can be calculated for driving, walking and truck routes.\n\nRoute Matrices are used in several different types of applications, most commonly to solve the Traveling Salesman Problem (TSP) and Vehicle Routing Problem (VRP). For each origin-destination pair in the matrix, the travel time and distance are returned. You can use the computed costs to determine which detailed routes to calculate using the Route Directions API.\n\n\nThe maximum size of a matrix for async request is **50000** (the number of origins multiplied by the number of destinations).\n\n\n### Submit Asynchronous Route Matrix Request\nThe Asynchronous API is appropriate for processing big volumes of relatively complex routing requests. When you make a request by using async request, by default the service returns a 202 response code along a URL in the `operation-Location` field of the response header with the Azure Maps geography endpoint `{geography}.atlas.microsoft.com. This URL should be checked periodically until the status is Succeeded. \n\n\nThe maximum size of a matrix for this API is **50000** (the number of origins multiplied by the number of destinations). With that constraint in mind, examples of possible matrix dimensions are: 500x100, 100x100, 280x170. 100x50 (it does not need to be square).\n\n\nThe asynchronous responses are stored for **24** hours. The redirect URL returns a 404 response if used after the expiration period.\n\n\n\n\n```\nPOST https://atlas.microsoft.com/route/matrix:async?api-version=2025-01-01&subscription-key={subscription-key}\n```\n\nHere's a typical sequence of asynchronous operations:\n1. Client sends a Route Matrix POST request to Azure Maps\n\n2. The server will respond with one of the following:\n\n > HTTP `202 Accepted` - Route Matrix request has been accepted.\n\n > HTTP `Error` - There was an error processing your Route Matrix request. This could either be a 400 Bad Request or any other Error status code.\n\n\n3. If the Matrix Route request was accepted successfully, the `operation-location` header in the response contains the URL to get the status of the request. This status URI looks like the following:\n\n ```\n GET https://atlas.microsoft.com/route/operations/{id}?api-version=2025-01-01?subscription-key={subscription-key}\n ```\n\n\n4. Client issues a GET request on the resultUrl obtained in Step 3 to get the results\n\n \n\n ```\n GET https://atlas.microsoft.com/route/operations/{id}/result?api-version=2025-01-01?subscription-key={subscription-key}\n ```\n\n\n\n ### API Limitations\n The asynchronous processing of matrix is best suited for larger matrices that require heavy route calculation. The following limitation is applicable to the asynchronous requests. If none of the rows in the following table match the request's parameters, the request does not meet the requirements and will not be processed.\n\n > Async requests supports up to 50K matrix size in a single request. If you want to request an increase to this limit, you can create an Azure Maps Technical Support Request in the Azure portal.\n\n \n| Max matrix\u00a0size\u00a0 | Max number\u00a0of origins | Max number\u00a0of destinations\u00a0 | Additional limits\u00a0|\n|------------------|-----------------------|-----------------------------|-------------------|\n| 2500\u00a0 | 1000\u00a0 | 1000\u00a0 | All origins and destinations should be contained in an axis-aligned 400\u202fkm\u202fx\u202f400\u202fkm bounding box. Otherwise some matrix cells will be resolved as\u202fOUT_OF_REGION.\u00a0 |\n| 50,000\u00a0 | 10,000\u00a0 | 10,000\u00a0 | - `departAt`\u202for\u202f`arriveAt`\u202fmust be\u202fany.
- `traffic`\u202fmust be\u202fhistorical.
- `optimizeRoute` must be\u202ffastest.
- `travelMode`\u202fmust be either\u202fdriving\u202for\u202ftruck.\u00a0
- No other parameters can be used explicitly.\u00a0 |\n\n\n" } }

⚼ Request

POST:  /route/matrix:async
{
api-version: string ,
x-ms-client-id: string ,
routeMatrixAsyncRequest:
{
type: enum ,
features:
[
{
type: enum ,
geometry: object ,
properties:
{
pointType: enum ,
}
,
}
,
]
,
departAt: string ,
arriveAt: string ,
travelMode: enum ,
optimizeRoute: enum ,
traffic: enum ,
avoid:
[
string ,
]
,
vehicleSpec: object ,
}
,
}

⚐ Response (202)

{
operation-location: string ,
}

⚐ Response (default)

{
$headers:
{
x-ms-error-code: string ,
}
,
$schema:
{
error:
{
code: string ,
message: string ,
target: string ,
details:
[
string ,
]
,
innererror:
{
code: string ,
innererror: string ,
}
,
}
,
}
,
}